{% extends "search_form.html" %}

{% block title %}Search Result{% endblock %}

{% block content %}

    {{ block.super }}

    {# {% if error or words %} {% endif %} #}

    {% if words %}
        <hr />
        <h2>Search result for '{{query}}'</h2>

        <p>Found {{words|length}} word{{words|pluralize}} </p>

            <ul>
                {% for w in words %}
                <li>
                    {# <li>{{ w }}</li> #}
                    {# {% if w.part_of_speech_fk %} [{{w.part_of_speech_fk}}] {% endif %} #}
                    {{ w.part_of_speech_fk.word_fk.word }},
                        {% if w.part_of_speech_fk.word_clarification %} {{w.part_of_speech_fk.word_clarification}} {% endif %}
                        {{w.part_of_speech_fk.part_of_speech}}.
                    {% if w.part_of_speech_alt %},{{w.part_of_speech_alt}}. {% endif %}
                    {% if w.main_definition %} {{w.main_definition}} {% endif %}
                    {% if w.synonym %} (={{w.synonym}}) {% endif %}
                    {% if w.antonym %} antonym='{{w.antonym}}' {% endif %}
                    {% if w.sino_vietnamese %} sino_vietnamese='{{w.sino_vietnamese}}' {% endif %}
                    {% if w.french %} french='{{w.french}}' {% endif %}
                    {% if w.restricted %} restricted='{{w.restricted}}' {% endif %}
                    {% if w.noun_classifier %} noun_classifier='{{w.noun_classifier}}' {% endif %}
                    {% if w.vietnamese_phrase %} <b>{{w.vietnamese_phrase}}</b> {% endif %}
                    {% if w.english_phrase %} {{w.english_phrase}} {% endif %}
                </li>
                {% endfor %}
            </ul>
    {% else %}
        {% if value_entered %}
            <hr />
            {% if errors %}
                <ul>
                    {% for error in errors %}
                    <li>{{ error }}</li>
                    {% endfor %}
                </ul>
            {% else %}
                <p>No words matched your query</p>
            {% endif %}
        {% endif %}
    {% endif %}
{% endblock %}

